<link rel="stylesheet" href="http://www.12301.cc/css/common/www.12301.cc.global.css"/>
<link rel="stylesheet" href="http://www.12301.cc/tpl/pft_show/css/common.css"/>
<link rel="stylesheet" href="http://www.12301.cc/tpl/pft_show/css/seat.css"/>

<style type="text/css">
    #venueUl{ overflow:hidden; padding:15px 0 15px 15px;}
    #venueUl .venueItem{ float:left; margin-right:15px; margin-bottom:15px;}
    #venueUl .venueItem .photo{ display:block; width:180px; height:120px; font-size:0; background-color:#f2f4f7; background-repeat:no-repeat; background-position:center center;
        background-size:cover;
    }
    #venueUl .venueItem .vtitle{ font-size:14px; line-height:1.4; color:#404348; margin-top:4px;}
    #venueUl .venueItem .btn{ margin-right:10px;}
    #venueUl .addBtn{ float:left; width:120px; height:120px; }
    #venueUl .addBtn .iconfont{ display:block; font-size:30px; margin-top:28px;}
    #venueUl .addBtn .t{ display:block; font-size:14px; position:relative; top:-5px;}
    #venueUl .addBtn a{ display:block; width:100%; height:100%; overflow:hidden; background:#dcdcdc; color:#019ad4; text-align:center; cursor:pointer;
        -webkit-transition:all 0.3s;
        -moz-transition:all 0.3s;
        -ms-transition:all 0.3s;
        -o-transition:all 0.3s;
        transition:all 0.3s;
    }
    #venueUl .addBtn a:hover{ background:#2a98da; color:#fff; text-decoration:none}
    .input-date{width: 130px;}
    .btn {
        float: right;
        display: block;
        width: 100px;
        height: 32px;
        line-height: 32px;
        margin-right: 16px;
        background: #2a98da;
        color: #fff !important;
        text-align: center;
        text-decoration: none !important;
    }
    .round-list-tbl{
        width: 100%;
        table-layout: fixed;
    }
    .round-list-tbl th,
    .round-list-tbl td{
        background-color:#eee;
        line-height: 36px;
        text-align: left;
        padding-left: 20px;
        font-size: 14px;
    }
    .round-list-tbl td{
        background-color: #FFF;
    }
    .round-list-tbl .time{
        width: 10%;
    }
    .round-list-tbl .name{
        width: 28%;
    }
    .round-list-tbl .handler{
        width: 20%;
    }
</style>
<!--[if lt IE 7]><div id="venueListContainer" class="lt-ie10 lt-ie9 lt-ie8 lt-ie7 ie6 seatContainer commonRigContainer"> <![endif]-->
<!--[if IE 7]><div id="venueListContainer" class="lt-ie10 lt-ie9 lt-ie8 ie7 seatContainer commonRigContainer"> <![endif]-->
<!--[if IE 8]><div id="venueListContainer" class="lt-ie10 lt-ie9 ie8 seatContainer commonRigContainer"> <![endif]-->
<!--[if IE 9]><div id="venueListContainer" class="lt-ie10 ie9 seatContainer commonRigContainer"><![endif]-->
<!--[if gt IE 9]><!--><div id="guanContainer" class="guanContainer commonRigContainer"> <!--<![endif]-->
    <div id="venuenameHead" class="venuenameHead">
        <p class="t"><span class="iconfont"></span><span id="venuename" class="venuename">【<?=$venue_name?>】场次管理</span></p>
    </div>
    <div id="createHeadWrap" class="formGroup create">
        <div class="row">
            <form id="search-form" method="get">
                <input value="rounds" name="m" type="hidden"/>
                <input value="<?=$rid?>" name="rid" type="hidden"/>
                <span>
                    日期： <input class="formInp input-date"
                                value="<?=$date?>"
                                type="text"
                                name="bt"
                                id="createSeatRowInp"
                                onclick="Calend.show()"
                        />
<!--                    <a href="javascript:;">查找</a>-->
                </span>
                <a id="btnSync" class="btn" title="同步场次到其它日期" data-day="<?=$day?>" data-rid="<?=$rid?>"
                   href="pft_show.html?m=round_sync&i=<?=$rid?>&d=<?=base64_encode($date)?>">同步场次</a>
                <a class="btn" href="pft_show.html?m=round_edit&i=<?=$rid?>&d=<?=base64_encode($date)?>">编辑</a>
                <a id="btnCreate" class="btn" href="pft_show.html?m=round_create&venus_id=<?=$rid?>">创建</a>
            </form>
        </div>
    </div>
    <div class="round-list">
        <table class="round-list-tbl">
            <thead>
            <tr>
                <th class="name">场次名称</th>
                <th class="time">开始时间</th>
                <th class="time">结束时间</th>
                <th>预售（天）</th>
                <th>余票</th>
                <th class="handler">操作</th>
            </tr>
            </thead>
            <tbody>
            <?php if(count($rounds)>0):?>
            <?php foreach($rounds as $round):?>
                <tr id="tr_<?=$round['id']?>">
                    <td><?=$round['round_name']?></td>
                    <td><?=$round['bt']?></td>
                    <td><?=$round['et']?></td>
                    <td><?=$round['pre_sale']?></td>
                    <td><?=isset($round['seat_left'])? $round['seat_left'] : $round['seat_total']?></td>
                    <td>
<!--                        --><?php //if($_GET['debug']):?>
                        <a href="pft_show_seat.html?m=round&venue_id=<?=$round['venus_id']?>&round_id=<?=$round['id']?>&round_name=<?=urlencode('【'.$round['use_date'].'】'.$round['round_name'].'--'.$round['bt'].'至'.$round['et'])?>">座位信息</a>
<!--                        --><?php //else:?>
<!--                        <a href="?m=seat&venue_id=--><?//=$round['venus_id']?><!--&round_id=--><?//=$round['id']?><!--&round_name=--><?//=urlencode('【'.$round['use_date'].'】'.$round['round_name'].'--'.$round['bt'].'至'.$round['et'])?><!--">座位信息</a>-->
<!--                        --><?php //endif;?>
                        <?php if($round['status']==0):?>
                        <a data-id="<?=$round['id']?>" class="cancel-round" href="javascript:;">取消</a>
                        <?php endif;?>
                    </td>
                </tr>
            <?endforeach;?>
            <?php endif;?>
            </tbody>
        </table>
    </div>
</div>
<script src="http://www.12301.cc/js/WdatePicker.js"></script>
<script type="text/javascript" src="http://www.12301.cc/js/global/www.12301.cc.global.js"></script>
<script type="text/javascript" src="http://wx.12301.cc/public/js/common/class.js"></script>
<script type="text/javascript" src="http://wx.12301.cc/public/js/common/ajax.js"></script>
<? include("tpl/calendar/calendar.html") ?>
<script>
    $(document).ready(function(){
        //场次列表-时间变更提交查询
//        $("input[name=bt]").on('change', function(){
//            $("#search-form").submit();
//        });
        //场次列表-取消场次
        $(".round-list-tbl").on('click','a.cancel-round', function(){
            if (!confirm('您确定要取消该场次吗？')) return false;
            var rid = $(this).data('id');
            $.ajax({
                type:'post',
                data:{rid:rid, status:1},
                dataType:'json',
                url:'call/jh_round.php?action=SET_ROUND_STATE',
//                before: function(){
//                    $btn.attr('disable','disable');
//                },
                success: function(json){
//                    $btn.removeAttr('disable');
                    if (json.code=='200') {
                        PFT_GLOBAL.U.Alert("success",'<p style="width:120px">操作成功</p>');
                        $("#tr_"+rid).hide();
                    } else {
                        PFT_GLOBAL.U.Alert("fail",'<p style="width:120px">'+json.msg+'</p>');
                    }
                }
            });
        });






    });
    //日历
    var Calend = {
        C : null,
        init : function(){
            var that = this;
            this.input = $("#createSeatRowInp");
            this.C = new Calendar2({
                container:$("#calendarWrap"),
                type : "allValid"
            });
            this.C.on("onValidSelect",function(date){
                that.input.val(date);
                $("#search-form").submit();
            })
        },
        show : function(){
            this.C.show();
        },
        close : function(){
            this.C.close();
        }
    };
    Calend.init();
</script>